package com.lg.fileservice.storage;

import com.lg.fileservice.model.StorageBo;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

public interface ObjectStorageService<T> {
    /*获取客户端链接*/
    T getClient();

    List<Object> uploadObjectByBytes(StorageBo storageBo) throws IOException;

    /*下载*/
    InputStream downloadByObjectName(StorageBo storageBo) throws IOException;

    /*删除*/
    void deleteFileByObjectName(StorageBo storageBo) throws IOException;

    void deleteFilesByObjectList(StorageBo storageBo) throws IOException;

    Boolean isObjectExist(String objectName);

    Boolean isObjectExist(StorageBo storageBo);

    default List<Object> initList() {
        int len = 3;
        ArrayList<Object> objects = new ArrayList<>(len);
        try {

            for (int i = 0; i < len; i++) {
                objects.add("");
            }
        } catch (Exception e) {
            e.printStackTrace();
            System.err.println(e.getMessage());
        }

        return objects;
    }

}
